package business

import (
	"group-buy/response"
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"group-buy/group_buy/internal/logic/business"
	"group-buy/group_buy/internal/svc"
	"group-buy/group_buy/internal/types"
)

func GetBusinessByUserIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.GetBusinessByUserIdReq
		if err := httpx.Parse(r, &req); err != nil {
			response.Response(w, nil, err)
			return
		}

		l := business.NewGetBusinessByUserIdLogic(r.Context(), svcCtx)
		resp, err := l.GetBusinessByUserId(&req)
		response.Response(w, resp, err)
	}
}
